/*
* yiji.com Inc.
* Copyright (c) 2017 All Rights Reserved.
* create by muyu
* date:2017-06-14
*/
package com.zerone.pay.trade.repository.entity;

import com.acooly.core.common.domain.AbstractEntity;
import lombok.Getter;
import lombok.Setter;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.validation.constraints.Size;

/**
 * tbl_trade Entity
 *
 * @author muyu
 *         Date: 2017-06-14 18:02:45
 */
@Entity
@Table(name = "trade")
@Setter
@Getter
public class Trade extends AbstractEntity {
    /**
     * serialVersionUID
     */
    private static final long serialVersionUID = 1L;

    /**
     * 交易号
     */
    @Size(max = 32)
    @Column(name = "trade_no", columnDefinition = "varchar(32) not null comment'交易号'")
    private String tradeNo;

    /**
     * 支付宝微信交易号
     */
    @Size(max = 64)
    @Column(name = "out_trade_no", columnDefinition = "varchar(64) comment'支付渠道交易号'")
    private String outTradeNo;

    /**
     * 渠道号
     */
    @Column(name = "agent_id", columnDefinition = "varchar(32) comment'代理商ID号'")
    private String agentId;


    @Column(name = "agent_name", columnDefinition = "varchar(32) comment'代理商商户名'")
    private String agentName;

    /**
     * 商户号
     */
    @Column(name = "merchant_id", columnDefinition = "varchar(32) comment'商户ID号'")
    private String merchantId;

    /**
     * 商户账号
     */
    @Column(name = "merchant_account_no", columnDefinition = "varchar(32) comment'商户账号'")
    private String merchantAccountNo;
    /**
     * 商户名
     */
    @Column(name = "merchant_name", columnDefinition = "varchar(32) comment'商户名称'")
    private String merchantName;

    /**
     * 微信的openid， 支付宝的购买人id
     */
    @Column(name = "buyer_id", columnDefinition = "varchar(32) comment'微信的openid， 支付宝的购买人id'")
    private String buyerId;

    /**
     * 交易金额
     */
    @Column(name = "trade_amount", columnDefinition = "bigint comment'交易金额以分为单位'")
    private Long tradeAmount;

    /**
     * 收费金额
     */
    @Column(name = "charge_amount", columnDefinition = "bigint comment'交易金额以分为单位'")
    private Long chargeAmount;

    /**
     * 优惠金额
     */
    @Column(name = "coupon_amount", columnDefinition = "bigint comment'优惠金额'")
    private Long couponAmount;

    /**
     * 费率
     */
    @Column(name = "rate", columnDefinition = "float comment'费率'")
    private Double rate;


    /**
     * 失败原因
     */
    @Column(name = "fail_reason", columnDefinition = "varchar(256) comment'失败原因'")
    private String failReason;

    /**
     * 外部商户订单号
     */
    @Size(max = 32)
    @Column(name = "out_order_no", columnDefinition = "varchar(32) comment'外部订单订单号'")
    private String outOrderNo;

    /**
     * 商品标题
     */
    @Size(max = 32)
    @Column(name = "subject", columnDefinition = "varchar(32) comment'标题'")
    private String subject;

    /**
     * 商品描述信息
     */
    @Size(max = 128)
    @Column(name = "body", columnDefinition = "varchar(128) comment'商品描述信息'")
    private String body;

    /**
     * 支付渠道编码
     */
    @Size(max = 128)
    @Column(name = "channel", columnDefinition = "varchar(128) comment'支付渠道编码'")
    private String channel;

    /**
     * 支付方式
     */
    @Size(max = 20)
    @Column(name = "pay_method", columnDefinition = "varchar(20) comment'支付方式'")
    private String payMethod;


    /**
     * 终端设备 ANDROID 或IOS
     */
    @Size(max = 20)
    @Column(name = "device_type", columnDefinition = "varchar(20) comment'终端设备'")
    private String deviceType;

    /**
     * 状态
     */
    @Column(name = "trade_status", columnDefinition = "varchar(20) comment'交易状态'")
    private String tradeStatus;

    /**
     * 备注
     */
    @Column(name = "description", columnDefinition = "varchar(256) comment'交易状态'")
    private String description;


    //-----------------INFO附加信息----------------
    @Transient
    private String bankType;

    @Transient
    private String notifyUrl;

    @Transient
    private String prepayId;

    @Transient
    private String codeUrl;

    @Transient
    private String expire;

    @Transient
    private String metadata;

    @Transient
    private String extra;

    @Transient
    private String clientIp;

    @Transient
    private String errCode;

    @Transient
    private String errCodeMsg;

    @Transient
    private String buyerLogonId;

}
